package com.github.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author fatfish
 * @version 1.0
 * @date 2025/8/21 10:05
 */
public class HelloController implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        // 创建模型和视图对象
        ModelAndView mv = new ModelAndView();

        // 封装数据 （Model）
        mv.addObject("msg", "Hello, Spring MVC! (Config Version)");
        // 设置视图名称 （View）
        mv.setViewName("hello");
        return mv;
    }
}
